<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<%@ page contentType="text/html; charset=UTF-8" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<jsp:useBean id="user" class="model.User" scope="session" />
<jsp:useBean id="putnaDuz" class="model.PutnaDuz" scope="session" />

<html>
<head>

<title>Pregled putne duzi</title>
</head>
<body>

<h1>Pregled putne duzi</h1>
<br>
<%
	if (user != null && user.isLoggedIn()) {
%>

<table cellspacing=0 cellpadding=3 border=0>
	<!-- 
	<tr>
		<td align=right>Sifra:</td>
		<td><c:out value="${putnaDuz.sifra.id}" /></td>
	</tr>
 -->
	<tr>
		<td align=right>Od:</td>
		<td><c:out value="${putnaDuz.mestoOd.naziv}" /></td>
	</tr>

	<tr>
		<td align=right>Do:</td>
		<td><c:out value="${putnaDuz.mestoDo.naziv}" /></td>
	</tr>

	<tr>
		<td align=right>Polazak:</td>
		<td><fmt:formatDate pattern="hh:mm" value="${putnaDuz.polazak}" /></td>
	</tr>

	<tr>
		<td align=right>Dolazak:</td>
		<td><fmt:formatDate pattern="hh:mm" value="${putnaDuz.dolazak}" /></td>
	</tr>

	<tr>
		<td align=right>Cena:</td>
		<td><c:out value="${putnaDuz.cena}" />din.</td>
	</tr>

	<tr>
		<td align=right>Povlastice:</td>
		<td><c:forEach var="ben" items="${putnaDuz.povlastica}">
			<c:out value="${ben.naziv} " />
		</c:forEach></td>
	</tr>

	<tr>
		<td align=right>Prevoznik:</td>
		<td><c:out value="${putnaDuz.prevoznik.naziv}" /></td>
	</tr>


	<!-- dodajemo prazan red -->
	<tr>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
	</tr>

	<tr>
		<td align="right">Izmenite ove<br>
		podatke:</td>
		<!-- Ne moramo da navodimo ID kod izmene, zato sto se menja
				prevoznik od tekuceg korisnika -->
		<td><a href="/trips?change=true&ID=${putnaDuz.sifra.id}">Izmena</a></td>
	</tr>

</table>

<%
	} else {
%>

<p>Niste se prijavili! <br>
<a href="/logIn">Logovanje</a></p>

<%
	}
%>

<p><a href="/timeTableServlet">Red voznje</a> <br>
<a href="/logIn?logOff=true">Odjava</a></p>

</body>
</html>